#pragma once

#include <vector>
#include <string>

enum class Mode {
    Idle = 0,    // 0. 空闲
    VelContol,   // 1. 控制行走 前进 Yaw角
    CreatMap,    // 2. 建图
    Navi,        // 3. 导航
    Kill = 4     // 关闭 ROS 进程
};


enum class CMD {
    Idle = 0,      // 0. 空闲
    VelContol,     // 1. 速度发布
    SaveMap,       // 2. 保存地图
    InitPose,      // 3. 初始位姿
    SetGoal,       // 4. 发送目的
    StopNavi       // 5. 停止导航
};

enum class SimpleClientGoalState {
// 中间状态
    PENDING = 0,      // Goal还没有被ActionServer处理
    ACTIVE,           // Goal正在被ActionServer处理
    Recalling,        // Goal没有被处理并且从客户端已发送取消它的命令
    Preempting,       // Goal正被处理呢，从ActionClient端收到了取消请求
// 终点状态
    RECALLED,         // ActionClient没有发cancle请求，Goal被ActionServer不处理直接拒绝了
    PREEMPTED,        // 处理中的Goal被另一个Goal或者ActionClient的取消请求给取消了
    ABORTED,          // Goal被AS终止没有ActionClient的cancle请求
    SUCCEEDED,        // Goal被ActionServer成功实现
    LOST              // 丢失
};
// https://www.cnblogs.com/feixiao5566/p/4757916.html

// const std::string ROS_MODE[] = {
//     "roslaunch yhs_can_control yhs_can_control.launch",
//     "roslaunch yhs_nav cartographer.launch",
//     "roslaunch yhs_nav navigation.launch",
// };

const std::string ROS_MODE[] = {
    "roslaunch ros_midware vel_control.launch",
    "roslaunch ros_midware cartographer.launch",
    "roslaunch ros_midware navigation.launch map_file:=",
};

const std::vector<std::string> ROS_VEL_NODE = {
    "rosnode kill /yhs_can_control_node"
};

const std::vector<std::string> ROS_CARTO_NODE = {
    "rosnode kill /HI226",
    "rosnode kill /base_link_to_laser",
    "rosnode kill /base_link_to_ul_laser",
    "rosnode kill /cartographer_node",
    "rosnode kill /cartographer_occupancy_grid_node",
    "rosnode kill /imu_broadcaster",
    "rosnode kill /laser_broadcaster",
    "rosnode kill /lidar_undistortion_node",
    "rosnode kill /nodelet_manager",
    "rosnode kill /nvilidar_node",
    "rosnode kill /path_loader",
    "rosnode kill /path_saver",
    "rosnode kill /robot_pose_ekf",
    "rosnode kill /velocity_smoother",
    "rosnode kill /yhs_can_control_node"
};

const std::string ROS_CMD[1] = {
    "rosrun map_server map_saver --free 45 --occ 55 -f ",
};

//"curl -X POST -F \"pgmFile=@/path/to/pgmFile\" -F \"yamlFile=@/path/to/yamlFile\" http://192.168.1.100:8666/sys/receiveMapFile",
const std::string CURL_CMD[3] = {
    "curl -X POST -F \"pgmFile=@",
    "curl -X POST -F \"tempFile=@",
    "\" -F \"yamlFile=@"
    // "\" http://192.168.1.100:8666/sys/receiveMapFile"
};

extern std::string curl_ipv4;
unsigned int generateCRC(const unsigned int timestamp);
void curl_image(const std::string image);
void curl_image(const std::string image, const std::string yaml);
bool isFileExists(const std::string& filename);
